package com.ftg.learn.chapter05;

/**
 * @author kangjx
 * @createTime 2022/7/11
 */
public class LearnBinary {

    /**
     * 将num转换成为二进制
     * @param num
     */
    public String tenToTwo(int num){
       return Integer.toBinaryString(num);
    }

    public String tenToEight(int num){
        return Integer.toOctalString(num);
    }

    public String tenToSixteen(int num){
        return Integer.toHexString(num);
    }

    public int luoJiYu(int n,int m){
        return n & m;
    }

    public int luoJiHuo(int n,int m){
        return n | m;
    }


    public int yiHuo(int n,int m){
        return n ^ m;
    }


}
